flask: fix reading strings from guest memory
authorJan Beulich <jbeulich@suse.com>
Thu, 6 Feb 2014 15:33:50 +0000 (16:33 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 6 Feb 2014 15:33:50 +0000 (16:33 +0100)
commit6c79e0ab9ac6042e60434c02e1d99b0cf0cc3470
treeaa50768c229f03d9b9e62c02da683de31c3e040c
parent15347ebb357fe587c2f9e55bdeb5ef6af36b7958
flask: fix reading strings from guest memory

Since the string size is being specified by the guest, we must range
check it properly before doing allocations based on it. While for the
two cases that are exposed only to trusted guests (via policy
restriction) this just uses an arbitrary upper limit (PAGE_SIZE), for
the FLASK_[GS]ETBOOL case (which any guest can use) the upper limit
gets enforced based on the longest name across all boolean settings.

This is XSA-84.

Reported-by: Matthew Daley <mattd@bugfuzz.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
xen/xsm/flask/flask_op.c
xen/xsm/flask/include/conditional.h
xen/xsm/flask/ss/services.c